#include "s3c2440.h"
#include "uart.h"
#include "rtc.h"
void delay(unsigned int ms);
void delay(unsigned int ms)
{
    unsigned long i,j;
    for(i = 0; i < ms; i++)
    {
        for( j = 0; j < 70000; j++ )
        {
        }
    }
}
int main()
{
    //void(*f)(void);
    //while(1)
    //TurnOnMpll(0);
    //SlowEnable(1);
    TIME_STRUCT Time;
   /* unsigned char Second,Minute,Hour,Date,WeekDay,Month,Year;
    Second = 50;
    Minute = 59;
    Hour  = 23;
    Date = 31;
    WeekDay = 1;
    Month = 12;
    Year = 12;*/
    GPBCON &= ~0X3;
    GPBCON |= 1;
    GPBDAT &= ~1;
    //

    Time.Second = 50;
    Time.Minute = 58;
    Time.Hour = 23;
    Time.Date = 31;
    Time.WeekDay = 1;
    Time.Month = 12;
    Time.Year = 12;
    RtcWrite(Time);
    Time.Second = 0;
    Time.Minute = 59;
    SetAlmTime(Time);
    while(1)
    {
        printf("SRCPND is %x\n",SRCPND);
        RtcRead(&Time);
       // putch('\n');
        printf("Year is %d\n",Time.Year);
        printf("Month is %d\n",Time.Month);
        printf("WeekDay is %d\n",Time.WeekDay);
        printf("Date is %d\n",Time.Date);
        printf("Hour is %d\n",Time.Hour);
        printf("Minute is %d\n",Time.Minute);
        printf("Second is %d\n",Time.Second);
        delay(10);
        if(Time.Minute == 1)
        {
            GPBDAT |= 1;
        }
    }
   return 0;

}


